import { _decorator, director, Scene } from 'cc';

export class MyEvent {
    static CARRIAGE_BUY = "CARRIAGE_BUY";
    static BUTTON_STYLE = "BUTTON_STYLE";
    static ENERGY = "ENERGY";
    static HP = "HP";
    static CARD_STATE = "CARD_STATE";
    static CARD_EVOLUTION = "CARD_EVOLUTION";
    static MONSTER_DIRX = "MONSTER_DIRX";
    static REMOVE_MONSTER = "REMOVE_MONSTER";
}

export class EventManager {
    public static get Scene(): Scene {
        return director.getScene();
    }

    public static on(type: string, callback: Function, target?: any) {
        director.getScene().on(type, callback, target);
    }

    public static off(type: string, callback?: Function, target?: any) {
        director.getScene()?.off(type, callback, target);
    }
}